package com.felight.ems.strings;
import java.io.File;
import java.io.*;
class WriteString{
	
	
	public static boolean writeSomethig(File f1, String data){
		FileWriter fw = null;
		try{
			fw = new FileWriter(f1);
			if(f1.canRead()){
				fw.write(data);
			}else{
				f1.createNewFile();
				fw.write(data);
			}
		}
		catch(FileNotFoundException e){
			System.out.println("File not does not exist!!"+f1.getName()+"and the exception"+e.toString());
		}
		catch(IOException e){
			System.out.println("Error while creating the file!!"+f1.getName()+" "+e.toString());
		}
		finally{
			try{
				fw.flush();
				fw.close();
			}
			catch(IOException e){
				e.printStackTrace();
			}
		return true;
			
		}
	}
}